﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ControlAccessUser.Bussiness;
using ControlAccessUser.Model;
using ControlAccessUser.Presenter;

namespace ControlAccessUser.Presentation
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window, ILoginView
    {
        PresenterLogin pLogin;
        public MainWindow()
        {            
            InitializeComponent();
            pLogin = new PresenterLogin(this);            
        }

        private void login_Click(object sender, RoutedEventArgs e)
        {
            pLogin.CheckLogin();
        }

        public string UserNameLogin
        {
            get { return txbxUserName.Text; }
        }

        public string UserPasswordLogin
        {
            get { return txbxUserPassword.Password; }
        }

        public void ErrorMessage(string message)
        {
            MessageBox.Show(message);
        }

        public void GoPrincipalWindow(User user)
        {
            (new Welcom(user)).ShowDialog();
            Clear();
        }

        private void Clear()
        {
            txbxUserName.Text ="";
            txbxUserPassword.Password="";
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

    }
}
